<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="">
    
    <title>首页</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="../../js/jquery-3.3.1.js"></script>
	<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
  </head>
  
  <body>
 <script type="text/javascript">
 	function addAnnouncement(){
 		$.ajax({
 			url:"${pageContext.request.contextPath}/announcement/add",
 			dataType:"json",
 			type:"post",
 			data:{aname:$("#aname").val(), content:$("#content").val(), time:getTime()},
 			success:function(data, status){
 				alert(data.message);
 				window.parent.center.location.href='announcementlist.jsp';
 		}});
 	};
 	
	function getTime()
	{
		var date = new Date();
		var year = date.getFullYear();
		var mouths = date.getMonth()+1;
		var day = date.getDate();
		return year+"-"+mouths+"-"+day;
	};
 </script>
<div class="container">
	<div class="row clearfix">
		<div class="col-md-12 column">
			<h3 class="text-center">
				公告发布栏
			</h3>
			<br/>
			&emsp;&emsp;&emsp;&emsp;标题：<input type="text" id="aname">
			<br/><br/>
			<div class="row clearfix">
				<div class="col-md-4 column">
				</div>
				<div class="col-md-4 column">
					<div class="form-group">
						&emsp;&emsp;&emsp;&emsp;<textarea cols="30" rows="15" id="content"></textarea>
					</div>
									<div class="row clearfix">
						<div class="col-md-4 column">
						</div>
						<div class="col-md-4 column">
						</div>
						<div class="col-md-4 column">
						&emsp;&emsp;&emsp;&emsp;<button type="button" class="btn btn-default" onclick="addAnnouncement()">提交</button>
						</div>
					</div>
				</div>
				<div class="col-md-4 column">
				</div>
			</div>
		</div>
	</div>
</div>
  </body>
</html>
